<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Auth::routes();

// 使用 Auth 中间件
Route::group(['middleware' => 'auth'], function () {

    Route::get('/', [ 'as' => 'index' , 'uses' => 'IndexController@index']);

    Route::resource('goods','GoodsController', ['only' => ['index' , 'destroy']]); //商品管理
    Route::get('createExcel',['as' => 'goods.excel.create' , 'uses' => 'GoodsController@createExcel']);//Excel上传商品页面
    Route::post('storeExcel',['as' => 'goods.excel.store' , 'uses' => 'GoodsController@storeExcel']);//Excel上传商品
    Route::get('deleteDay', ['as' => 'goods.delete.upload' , 'uses' => 'GoodsController@deleteDayUpload']);//删除当天xunsearch索引 (上传错误时)
    Route::get('updateDay', ['as' => 'goods.update.upload' , 'uses' => 'GoodsController@updateDayUpload']);//更新当天xunsearch索引 (上传错误时)
    Route::get('deleteDayData', ['as' => 'goods.delete.Data' , 'uses' => 'GoodsController@deleteDayData']);//删除当天xunsearch数据 (上传错误时)

    //categor
    Route::get('category' , ['as' => 'category.index' , 'uses' => 'CategoryController@index']); // 分类管理
    Route::post('category/use' , ['as' => 'category.use' , 'uses' => 'CategoryController@isuse']); // 是否使用
    Route::post('category/sort' , ['as' => 'category.sort' , 'uses' => 'CategoryController@updateSort']); // 排序

    //search Test

//    Route::get('search' , 'TestController@index');
//    Route::get('add', 'TestController@add');
//    Route::get('del', 'TestController@del');
//    Route::get('unq', 'TestController@unq');

});
// 执行linux 脚本  不需要登录权限
Route::get('deleteRepeatGoods' , ['as' => 'goods.delete.repeatGoods' , 'uses' => 'GoodsController@deleteRepeatGoods']);//删除重复商品
Route::get('deleteExpiredGoods' , ['as' => 'goods.delete.expiredGoods' , 'uses' => 'GoodsController@deleteExpiredGoods']);//删除优惠券过期商品

